#include <httpd.h>
#include <http_protocol.h>
#include <http_config.h>

#include <curl/curl.h>

static int otter_handler(request_rec *r) {
  if (!r->handler || (strcmp(r->handler, "otter"))) {
    return DECLINED;
  }

  if (r->method_number != M_GET) {
    return HTTP_METHOD_NOT_ALLOWED;
  }

  ap_set_content_type(r, "text/html;charset=ascii");
  ap_rputs("<h1> Hello World </h1>", r);
  return OK;
}

static void otter_hooks(apr_pool_t *pool) {
  ap_hook_handler(otter_handler, NULL, NULL, APR_HOOK_MIDDLE);
}

// Output filter
apr_status_t otter_output_filter(ap_filter_t* f, apr_bucket_brigade* bb) {

}

// mod_filter hook call back
static void filter_insert(request_rec *r) {
  mod_filter chain *p;
  ap_filter_rc_t *filter;
  mod_filter_cfg *cfg = ap_get_module_config(r->per_dir_config, &filter_module);
}

// mod_filter hook, similar to otter_hooks
static void filter_hooks (apr_pool_t *pool) {
  ap_hook_insert_filter(filter_insert, NULL, NULL, APR_HOOK_MIDDLE);
}


module AP_MODULE_DECLARE_DATA otter_module = {
  STANDARD20_MODULE_STUFF,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  otter_hooks

};
